package xiegd.study;

import org.junit.Test;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: xieguangda
 * @Description:
 * @Date: 2023/5/15 14:58
 */
public class TestT {
    public static void main(String[] args) {
        //String nowDatePlusTime = getNowDatePlusTime(1, null, null);
        //当前时间+24小时
        String startTime = getNowDatePlusTime(1,null,null);
        //当前时间+24小时+15分钟
        String endTime = getNowDatePlusTime(1,null,15);

        System.out.println("我是测试啊啊啊：：" + startTime);
        System.out.println("我是测试啊啊啊：：" + endTime);
    }

    public static String getNowDatePlusTime(Integer plusDay,Integer plusHours,Integer plusMinutes){
        LocalDateTime time = LocalDateTime.now();
        if(plusDay !=null){
            time = time.plusDays(plusDay);
        }
        if(plusMinutes != null){
            time = time.plusMinutes(plusMinutes);
        }
        if(plusHours != null){
            time = time.plusHours(plusHours);
        }
        time = time.withSecond(0);
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String dateStr = time.format(fmt);
        return dateStr;
    }


    @Test
    public void mytest(){
        String s = String.valueOf(null);
        System.out.println("wo shi cehshi::" +s);
    }


    @Test
    public void mytest343(){
        List<String> words = new ArrayList<>();

        words.add("hello");
        words.add("world");
        List<String> uniqueCharacters =
                words.stream().map(w -> w.split("")) //将每个单词转换为由其字母构成的数组
                        .flatMap(Arrays::stream) //将各个生成流扁平化为单个流
                        .distinct()
                        .collect(Collectors.toList());

        System.out.println("我是测试看看：：" + uniqueCharacters);
    }
}
